import {findAll,commentExamine,commentRefuseExamine} from '@/api/comment.js'


export default{
  namespaced:true,
  state:{
    totalData:[],
    ExtotalData:[],
    RestotalData:[],
  },
  getters:{
  },
  mutations:{
    changTotalData(state,data){
      state.totalData=data;
    },
    changeExamineData(state,data){
      state.ExtotalData=data;
    },
    changeExamineRefuseData(state,data){
      state.RestotalData=data;
    },

  },
  actions:{
    /**
     * 查找所有评论
     */
     findAll({commit},payload){
      findAll(payload).then(res=>{
        commit('changTotalData',res.data);
      })
     },
     /**
      * 评论审核通过
      */
      async commentExamine({commit},payload){
        let res=await commentExamine(payload);
        commit('changeExamineData',res.data);
      },
      /**
       * 评论审核不通过
       */
       async commentRefuseExamine({commit},payload){
        let res=await commentRefuseExamine(payload);
        commit('changeExamineRefuseData',res.data);
      },
  }
}